QR code generation method and apparatus for terminal device

ABSTRACT

Disclosed in embodiments of the present application are a QR code generation method and apparatus for a terminal device. The terminal device comprises a camera. A specific implementation mode of the method comprises: receiving a QR code generation instruction input by a user, wherein the QR code generation instruction comprises a QR code information; starting a camera, and generating a camera real-time photographing picture; and generating a real-time picture displaying the QR code based on the QR code information and the generated camera real-time photographing picture. The implementation mode enables the user to clearly distinguish whether the QR code is an originally generated QR code, thereby improving the security of the QR code.

This patent application is a national stage of International ApplicationNo. PCT/CN2019/085146, filed on Apr. 30, 2019, which claims priority toChinese Patent Application No. 201810653369.0, filed on Jun. 22, 2018,titled “Two-Dimensional Code Generation Method and Apparatus Applied toTerminal Device,” filed by Beijing Jingdong Shangke InformationTechnology Co., Ltd., and Beijing Jingdong Century Trade Co., Ltd. Bothof the aforementioned applications are incorporated herein by referencein their entireties.

FIELD

Embodiments of the present disclosure relate to the field of computertechnologies, and more particularly, to a two-dimensional codegeneration method and apparatus applied to a terminal device.

BACKGROUND

With the development of information processing technology,two-dimensional codes have been widely used because of their wide codingrange. A two-dimensional code is generally a black-and-white color blockarranged according to a certain rule on a two-dimensional plane, and thecolor block may be a geometric figure such as a square or a triangle. Ofcourse, the color blocks in the two-dimensional code may alternativelybe other colors of different shades, such as colors.

Currently, a two-dimensional code displayed on an electronic device isgenerally a static black-and-white picture or a black-and-white picturecontaining a static icon in the middle. Existing two-dimensional codesgenerally have no background image, or the background image is the same.Since the two-dimensional code is still valid after the screenshot, itis difficult for the user to recognize whether the two-dimensional codeto be scanned (the two-dimensional code without the background image orthe two-dimensional code with the same background image) is atwo-dimensional code formed by screenshot, photographing, or the like.In certain special scenarios, such as payment or authentication,two-dimensional codes formed by screenshots or the like leave room forcheating.

SUMMARY

The embodiment of the disclosure provides a two-dimensional codegeneration method and apparatus applied to a terminal device.

According to a first aspect, an embodiment of the present disclosureprovides a two-dimensional code generation method applied to a terminaldevice, the terminal device including a camera, the method including:receiving a two-dimensional code generation instruction input by a user,wherein the two-dimensional code generation instruction comprisestwo-dimensional code information; starting the camera to generate acamera real-time capturing picture; and generating a real-time picturedisplaying the two-dimensional code based on the two-dimensional codeinformation and the generated camera real-time capturing picture.

In some embodiments, the generating a real-time picture displaying atwo-dimensional code based on the two-dimensional code information andthe generated camera real-time capturing picture includes: performingblurring processing on the camera real-time capturing picture; andconverting the two-dimensional code information into a two-dimensionalcode, and displaying the generated two-dimensional code on the blurredcamera real-time capturing picture.

In some embodiments, the generating a real-time picture displaying atwo-dimensional code based on the two-dimensional code information andthe generated camera real-time capturing picture includes: convertingthe two-dimensional code information into a two-dimensional code, anddisplaying the generated two-dimensional code on the generated camerareal-time capturing picture.

In some embodiments, after generating a real-time picture displaying thetwo-dimensional code based on the two-dimensional code information andthe generated camera real-time capturing picture, the method furtherincludes: setting a distance value between adjacent color blocks in thetwo-dimensional code as a first preset threshold.

In some embodiments, the generating a real-time picture displaying atwo-dimensional code based on the two-dimensional code information andthe generated camera real-time capturing picture includes: setting atarget error tolerance rate of the two-dimensional code, wherein thetarget error tolerance rate is greater than a second preset threshold;and converting the two-dimensional code information into thetwo-dimensional code based on the target error tolerance rate, anddisplaying the generated two-dimensional code on the generated camerareal-time capturing picture.

In some embodiments, the method further includes: turning off the camerain response to receiving a two-dimensional code turn-off command inputby the user.

According to a second aspect, an embodiment of the present disclosureprovides a two-dimensional code generation apparatus applied to aterminal device, the terminal device including a camera, the apparatusincluding: a receiving unit configured to receive a two-dimensional codegeneration instruction input by a user, wherein the two-dimensional codegeneration instruction comprises two-dimensional code information; acaptured picture generating unit configured to start the camera togenerate a camera real-time capturing picture; and a two-dimensionalcode picture generating unit configured to generate a real-time picturedisplaying the two-dimensional code based on the two-dimensional codeinformation and the generated camera real-time capturing picture.

In some embodiments, he two-dimensional code picture generating unit isfurther configured to: perform blurring processing on the camerareal-time capturing picture; and convert the two-dimensional codeinformation into the two-dimensional code, and display the generatedtwo-dimensional code on the blurred camera real-time capturing picture.

In some embodiments, the two-dimensional code picture generating unit isfurther configured to: convert the two-dimensional code information intothe two-dimensional code, and display the generated two-dimensional codeon the generated camera real-time capturing picture.

In some embodiments, the apparatus further includes a setting unitconfigured to set a distance value between adjacent color blocks in thetwo-dimensional code as a first preset threshold.

In some embodiments, the two-dimensional code picture generation unit isfurther configured to set a target error tolerance rate of thetwo-dimensional code, wherein the target error tolerance rate is greaterthan a second preset threshold; and convert the two-dimensional codeinformation into the two-dimensional code based on the target errortolerance rate, and display the generated two-dimensional code on thegenerated camera real-time capturing picture.

In some embodiments, the apparatus further includes a camera turn-offunit configured to turn off the camera in response to receiving atwo-dimensional code turn-off command input by a user.

According to the two-dimensional code generation method and apparatusapplied to a terminal device provided in the embodiment of the presentdisclosure, a two-dimensional code generation instruction input by auser may be received, and then a camera may be started to generate acamera real-time capturing picture, and finally a real-time picturedisplaying the two-dimensional code may be generated based on thetwo-dimensional code information and the generated camera real-timecapturing picture.

BRIEF DESCRIPTION OF THE DRAWINGS

Other features, objects, and advantages of the present disclosure willbecome more apparent by reading the detailed description of non-limitingembodiments made with reference to the following drawings:

FIG. 1 is an example system architecture diagram in which an embodimentof the present disclosure may be applied;

FIG. 2 is a flowchart of an embodiment of a two-dimensional codegeneration method applied to a terminal device according to the presentdisclosure;

FIG. 3 is a schematic diagram of an application scenario of atwo-dimensional code generation method applied to a terminal deviceaccording to the present disclosure;

FIG. 4 is a flowchart of yet another embodiment of a two-dimensionalcode generation method applied to a terminal device according to thepresent disclosure;

FIG. 5 is a schematic structural diagram of an embodiment of atwo-dimensional code generating apparatus applied to a terminal deviceaccording to the present disclosure;

FIG. 6 is a schematic structural diagram of a computer system adaptedfor implementing an electronic device according to an embodiment of thepresent disclosure.

DETAILED DESCRIPTION

The present disclosure is described in further detail below withreference to the accompanying drawings and examples. It is to beunderstood that the specific embodiments described herein are merelyillustrative of the related disclosure and are not restrictive of thedisclosure. It is also to be noted that, for ease of description, onlyparts related to the disclosure are shown in the drawings.

It should be noted that the embodiments in the present disclosure andthe features in the embodiments may be combined with each other withoutconflict. The present disclosure will now be described in detail withreference to the accompanying drawings and examples.

FIG. 1 illustrates an example system architecture 100 in which anembodiment of a two-dimensional code generation method applied to aterminal device or a two-dimensional code generation apparatus appliedto a terminal device of the present disclosure may be applied.

As shown in FIG. 1, the system architecture 100 may include terminaldevices 101, 102, 103, a network 104, and a server 105. The network 104serves as a medium for providing a communication link between theterminal devices 101, 102, 103 and the server 105. Network 104 mayinclude various types of connections, such as wired, wirelesscommunication links, or fiber optic cables, among others.

The user may interact with the server 105 through the network 104 usingthe terminal devices 101, 102, 103 to receive or send messages, etc. Theterminal devices 101, 102 and 103 are provided with a camera which canbe used for image acquisition. Various client applications, such associal platform software, payment applications, web browserapplications, shopping applications, search applications, instantmessaging tools, mailbox clients, and the like, may be installed on theterminal devices 101, 102, 103.

The terminal devices 101, 102, 103 may be various electronic deviceshaving a display screen and supporting image acquisition andtwo-dimensional code display, including but not limited to a smartphone,a tablet computer, an electronic book reader, a laptop computer, adesktop computer, and the like.

It will be appreciated that the terminal devices 101, 102, and 103 maysupport not only image acquisition and two-dimensional code display, butalso the terminal devices 101, 102, and 103 may perform analysisprocessing on the obtained camera real-time capturing pictures,two-dimensional code information, and the like to obtain two-dimensionalcodes. In this case, the two-dimensional code generation method appliedto the terminal device provided in the embodiment of the presentdisclosure may be executed by the terminal devices 101, 102, and 103.Accordingly, the two-dimensional code generating apparatus applied tothe terminal may be arranged in the terminal devices 101, 102, 103. Inthis case, the server 105 and the network 104 may not need to bedisposed in the system architecture 100.

It should be further understood that the two-dimensional codes displayedon the terminal devices 101, 102, and 103 may be two-dimensional codesobtained by the server 105 by analyzing the received two-dimensionalcode generation instruction and the data such as the real-time picturecaptured by the camera. The terminal devices 101, 102, and 103 mayacquire the two-dimensional code information from the server 105 throughthe network 104 and generate the displayed two-dimensional codes. Inthis case, the two-dimensional code generation method applied to theterminal device provided in the embodiment of the present disclosure maybe executed by the server 105, and accordingly, the two-dimensional codegeneration apparatus applied to the terminal device is generallyarranged in the server 105.

It should be noted that the server may be hardware or software. When theserver is hardware, the server may be implemented a distributed servercluster composed of multiple servers, or a single server may beimplemented. When the server is software, it may be implemented as aplurality of software pieces or software modules (e.g., for providingdistributed services), or it may be implemented as a single softwarepiece or software module, which is not specifically limited herein.

It should be understood that the number of terminal devices, networksand servers in FIG. 1 is merely illustrative. There may be any number ofterminal devices, networks, and servers as desired for implementation.

With continuing reference to FIG. 2, a flow 200 of an embodiment of atwo-dimensional code generation method applied to a terminal deviceaccording to the present disclosure is shown. The two-dimensional codegeneration method applied to a terminal device includes the followingsteps.

Step 201 includes receiving a two-dimensional code generationinstruction input by a user.

In the present embodiment, in the case where the user performs payment,authentication, or the like using the terminal device, the user mayinput the two-dimensional code generation instruction to the terminaldevice by clicking, touch, or the like. An execution body of thetwo-dimensional code generation method applied to a terminal device (forexample, the terminal devices 101, 102, 103 shown in FIG. 1) may receivethe two-dimensional code generation instruction input by the user. Thetwo-dimensional code generation instruction may include two-dimensionalcode information for generating the two-dimensional code. Generally, thetwo-dimensional code information may include data information such ascharacters, numbers, letters, images, and sounds.

Step 202 includes: starting a camera, to generate a camera real-timecapturing picture.

In this embodiment, the terminal device may be provided with a camera.For example, a front-facing camera or a rear-facing camera of a mobileterminal. In response to receiving the two-dimensional code generationinstruction in step 201, the above-described execution body (e.g., theterminal devices 101, 102, 103 shown in FIG. 1) may start the cameramounted on the terminal device. After the camera is started, thesurrounding environment can be photographed in real time, therebygenerating a camera real-time capturing picture. It will be appreciatedthat the generated camera real-time capturing picture may be displayedon the terminal device. As an example, the terminal device may be amobile phone, and after the camera on the mobile phone is started, apicture captured by the camera may be displayed on a display screen ofthe mobile phone in real time. It will be appreciated that the picturecapture by the camera in real time may not be stored.

Step 203 includes: based on the two-dimensional code information and thegenerated picture captured by the camera in real time, generating areal-time picture displaying the two-dimensional code.

In the present embodiment, after receiving the two-dimensional codeinformation in the two-dimensional code generation instruction and thecamera real-time capturing picture acquired by the camera, theabove-mentioned execution body can generate a real-time picturedisplaying the two-dimensional code based on the two-dimensional codeinformation and the camera real-time capturing picture. As an example,the above-described execution body may perform a series of conversionsof the two-dimensional code information, and convert the two-dimensionalcode information into a two-dimensional code pattern storing thetwo-dimensional code information and being located at the camerareal-time capturing picture. It will be appreciated that the surroundingenvironment may be photographed in real time after the camera isstarted, so that the interface of the terminal device can display thecurrent-frame picture captured by the camera, that is, the current-framepicture is the camera real-time capturing picture. The two-dimensionalcode obtained by converting the two-dimensional code information isdisplayed in a current-frame picture captured by the camera, therebygenerating a real-time picture displaying the two-dimensional code.

In some alternative implementations of the present embodiment, theabove-described execution body may convert the two-dimensional codeinformation into a two-dimensional code pattern directly on the camerareal-time capturing picture, thereby generating a real-time picturedisplaying the two-dimensional code. Alternatively, the above-describedexecution body may perform image processing on the camera real-timecapturing picture generated by the camera acquisition, and then convertthe two-dimensional code information into a two-dimensional code patternin the processed camera real-time capturing picture.

Compared with a static two-dimensional code without a background imageand a static two-dimensional code with a background image in theexisting technology, for a two-dimensional code generated by using themethod provided in the embodiments of the present disclosure, abackground image of the two-dimensional code is a real-time pictureobtained by photographing a surrounding environment by using a camera ofthe terminal device of the user, so that a code sweeping side (a sidethat scans the generated two-dimensional code) can determine whether thetwo-dimensional code displayed on the terminal device is an originallygenerated two-dimensional code from the background image of thegenerated two-dimensional code, thereby avoiding information leakagecaused by screenshot or photographing of the two-dimensional code, andimproving security of the two-dimensional code.

In some alternative implementations of the present embodiment, theabove-described execution body may scan the generated two-dimensionalcode after a real-time picture displaying the two-dimensional code isgenerated. Receiving a two-dimensional code turn-off instruction inputby a user after the code scanning side completes scanning of thegenerated two-dimensional code, so that the execution body may turn offthe camera.

In some alternative implementations of the present embodiment, after thescanning of the generated two-dimensional code by the code sweeping sideis completed, the above-mentioned execution body may directly generate aturn-off instruction of the two-dimensional code, and turn off thecamera that has been started.

In some alternative implementations of the present embodiment, in thetwo-dimensional code real-time picture generated and displayed by theabove-mentioned execution body, the size of the two-dimensional codepattern may be the same as the size of the camera real-time capturingpicture. Alternatively, the size of the two-dimensional code pattern maybe smaller than the size of the camera real-time capturing picture, andthe two-dimensional code image may be located at a middle position or atany corner position of the camera real-time capturing picture.

Generally, converting the two-dimensional code information into atwo-dimensional code pattern may include a plurality of steps. First,the original data in the two-dimensional code information is encodedinto a series of character strings according to a certain pattern, forexample, the original data is formed into a binary character stringcomposed of 0 and 1 according to binary encoding, and then the binarycharacter string is further converted into a color block columnaccording to the principle that 1 represents a dark color block and 0represents a light color block, and finally the color block sequence isfilled into a square matrix according to a specific rule, therebyforming the two-dimensional code. Generally, there is no gap between thecolor blocks in the generated two-dimensional code. Therefore, after theconventional two-dimensional code is generated, the user cannot see thebackground image of the two-dimensional code through the two-dimensionalcode. According to the method provided in above embodiments of thepresent disclosure, a first preset threshold may be preset, and theexecution body may control a distance between adjacent color blocks ofthe generated two-dimensional code to be the first preset threshold.Therefore, by setting the first preset threshold, a certain gap can beformed between adjacent color blocks in the generated two-dimensionalcode, and the background of the two-dimensional code can be moreconveniently seen by the user through the gap, so that whether thetwo-dimensional code displayed by the user is a screenshot or the likecan be more easily identified, thereby further improving the security ofthe two-dimensional code.

Continuing to refer to FIG. 3, FIG. 3 is a schematic diagram of anapplication scenario of a two-dimensional code generation method appliedto a terminal device according to the present embodiment. In theapplication scenario of FIG. 3, a mobile phone may receive atwo-dimensional code generation instruction input by the user, and thetwo-dimensional code generation instruction may include two-dimensionalcode information. Then, the front-facing camera 301 (or the rear-facingcamera) of the mobile phone is started so that the front-facing cameraof the mobile phone can photographing the surrounding environment inreal time, thereby generating a camera real-time capturing picture, asshown in FIG. 3. It will be appreciated that the camera may be startedusing the “camera” application software in the mobile phone. Finally,based on the two-dimensional code information and the real-time picturecaptured by the camera, a real-time picture 302 superimposingtwo-dimensional codes can be generated and displayed on the mobilephone, as shown in FIG. 3. The real-time picture superimposing thetwo-dimensional code may include a two-dimensional code patternconverted from the two-dimensional code information and a picturecaptured by the camera in real time and used as a dynamic backgroundimage, and the real-time picture superimposing two-dimensional code maybe displayed on an interface opened by the “camera” applicationsoftware.

According to the two-dimensional code generation method and apparatusapplied to a terminal device provided in the embodiment of the presentdisclosure, a two-dimensional code generation instruction input by auser may be received, and then a camera may be started to generate apicture captured by the camera in real time, and finally a real-timepicture displaying the two-dimensional code can be generated based onthe two-dimensional code information and the generated camera real-timecapturing picture.

Referring further to FIG. 4, there is shown a flow 400 of anotherembodiment of a two-dimensional code generation method applied to aterminal device. The flow 400 of the two-dimensional code generationmethod applied to a terminal device includes the following steps.

Step 401 includes: receiving a two-dimensional code generationinstruction input by a user.

In the present embodiment, when the user performs payment orauthentication using the terminal device or the like, the user may inputa two-dimensional code generation instruction to the terminal devicethrough an operation such as clicking or touching. An execution body ofa two-dimensional code generation method applied to a terminal device(for example, the terminal devices 101, 102, 103 shown in FIG. 1) mayreceive a two-dimensional code generation instruction input by a user.The two-dimensional code generation instruction may includetwo-dimensional code information for generating the two-dimensionalcode. Generally, the two-dimensional code information may include datainformation such as characters, numbers, letters, images, and sounds.

Step 402 includes: starting the camera to generate a camera real-timecapturing picture.

In the embodiment, the terminal device may be provided with a camera.For example, a front-facing camera or a rear-facing camera of a mobileterminal. Based on the two-dimensional code generation instructionreceived in step 201, the above-mentioned execution body (for example,the terminal devices 101, 102, 103 shown in FIG. 1) may start the cameramounted on the terminal device. After the camera is started, thesurrounding environment can be photographed in real time, so that thegenerated camera real-time capturing picture can be obtained. It will beappreciated that the generated camera real-time capturing picture may bedisplayed on the terminal device. As an example, the terminal device maybe a mobile phone, and after the camera on the mobile phone is started,a picture captured by the camera may be displayed on a display screen ofthe mobile phone in real time. It will be appreciated that the camerareal-time capturing picture may not be stored, for example, the camerareal-time capturing picture may be a picture displayed on the interfaceby opening a “camera” application in the mobile phone without capturingand storing the picture displayed on the interface.

Step 403 includes: performing blurring processing on the camerareal-time capturing picture.

In the present embodiment, based on the camera real-time capturingpicture generated in step 402, the above-described execution body mayperform blurring processing on the generated camera real-time capturingpicture using various methods such as a direct convolution method, anFFT (fast Fourier transform) method based on a convolution theorem, andan integral graph method.

As an example, the blurred picture may be obtained by performing aconvolutional operation after zooming out camera real-time capturingpicture. Specifically, an appropriate zooming factor may first beselected to zoom out the generated camera real-time capturing picture;then a convolution operation may be performed on a filtered template andthe zoom-out camera real-time capturing picture so that the zoom-outcamera real-time capturing picture is blurred; finally, the blurredzoom-out picture may be enlarged by a linear interpolation operation, sothat a blurred camera real-time capturing picture with the same size asthe original picture can be obtained.

Step 404 includes: converting the two-dimensional code information intoa two-dimensional code, and displaying the generated two-dimensionalcode in blurred camera real-time capturing picture.

In the present embodiment, the above-described execution body mayconvert the two-dimensional code information into a two-dimensional codepattern and display the converted two-dimensional code in the blurredcamera real-time capturing picture, based on the blurred camerareal-time capturing picture obtained in step 403. The two-dimensionalcode pattern is generated on the camera real-time capturing pictureafter the camera real-time capturing picture is blurred, so that thesuccess rate of code scanning of the generated two-dimensional code canbe improved.

For example, the generated two-dimensional code picture may be composedof a black block and a white block, and in the camera real-timecapturing picture, there may be a black block or a white block that isthe same or similar in shape to the black block and the white block inthe two-dimensional code. The presence of such a color block may causethe two-dimensional code generated in the unprocessed camera real-timecapturing picture to fail to be scanned. However, after the blurringprocess is performed on the camera real-time capturing picture, theprobability of determination that the black block or the white blockhaving the same shape or similar shape as the black block and the whiteblock in the two-dimensional code is a part of the generatedtwo-dimensional code can be reduced, thereby increasing the probabilityof successful code scanning of the generated two-dimensional code.

In some alternative implementations of the present embodiment,generating a real-time picture displaying the two-dimensional code basedon the two-dimensional code information may further include: setting atarget error tolerance rate of the two-dimensional code, where thetarget error tolerance rate is greater than a second preset threshold;converting the two-dimensional code information into the two-dimensionalcode at the target error tolerance rate, and displaying the generatedtwo-dimensional code in the generated camera real-time capturingpicture. Specifically, after the execution subject starts the camera togenerate a camera real-time capturing picture, the execution subject mayset a target error tolerance rate for a two-dimensional code to begenerated, and may ensure that the target error tolerance rate can be alarge value by defining that the target error tolerance rate is greaterthan the second preset threshold; then, the execution body may convertthe two-dimensional code information into the two-dimensional code basedon the target error tolerance rate, and display the generatedtwo-dimensional code on the generated camera real-time capturingpicture. The method can also improve the success rate of scanning thegenerated two-dimensional code. The error tolerance rate of thetwo-dimensional code, also referred to as the error correction rate ofthe two-dimensional code, can generally represent the ability ofscanning the blocked two-dimensional code. In general, the higher thefault tolerance rate is, the more portions of the two-dimensional codepattern can be blocked.

In some alternative implementations of the present embodiment,generating a real-time picture displaying the two-dimensional code basedon the two-dimensional code information may further include setting atarget error tolerance rate of the two-dimensional code, where thetarget error tolerance rate is greater than a second preset threshold;converting the two-dimensional code information into the two-dimensionalcode based on the target error tolerance rate, and displaying thegenerated two-dimensional code on a blurred camera real-time capturingpicture.

As can be seen from FIG. 4, compared with the embodiment correspondingto FIG. 2, the flow 400 of the two-dimensional code generation methodapplied to the terminal device in the present embodiment highlights thestep of generating a real-time picture displaying the two-dimensionalcode based on the two-dimensional code information and the generatedcamera real-time capturing picture. As a result, the solution describedin the present embodiment can improve the security of thetwo-dimensional code while improving the probability of successfulscanning of the two-dimensional code.

With further reference to FIG. 5, as an implementation of the methodshown in above figures, the present disclosure provides an embodiment ofa two-dimensional code generating apparatus applied to a terminaldevice, which corresponds to the method embodiment shown in FIG. 2, andwhich is particularly applicable to various electronic devices.

As shown in FIG. 5, the two-dimensional code generation apparatus 500applied to a terminal device according to the present embodimentincludes a receiving unit 501, a captured picture generation unit 502,and a two-dimensional code picture generation unit 503. The terminaldevice may include a camera. The receiving unit 501 is configured toreceive a two-dimensional code generation instruction input by a user,where the two-dimensional code generation instruction includestwo-dimensional code information; The captured picture generating unit502 is configured to start a camera to generate a camera real-timecapturing picture; the two-dimensional code picture generating unit 503is configured to generate a real-time picture displaying thetwo-dimensional code based on the two-dimensional code information andthe generated camera real-time capturing picture.

According to the two-dimensional code generation apparatus 500 appliedto a terminal device provided in the embodiments of the presentdisclosure, the receiving unit 501 may receive a two-dimensional codegeneration instruction input by a user, and then the captured picturegeneration unit 502 may start a camera to generate a camera real-timecapturing picture, and finally, the two-dimensional code picturegeneration unit 503 may generate a real-time picture displaying atwo-dimensional code based on the two-dimensional code information andthe generated camera real-time capturing picture, so that the user candistinguish whether the generated two-dimensional code is a screenshotof two-dimensional code, thereby improving the security of thetwo-dimensional code information.

In some alternative implementations of the present embodiment, thetwo-dimensional code picture generation unit 503 is further configuredto perform blurring processing on the camera real-time capturingpicture; convert the two-dimensional code information into atwo-dimensional code, and display the generated two-dimensional code onthe blurred camera real-time capturing picture.

In some alternative implementations of the present embodiment, thetwo-dimensional code picture generation unit 503 is further configuredto convert the two-dimensional code information into a two-dimensionalcode, and display the generated two-dimensional code on the generatedcamera real-time capturing picture.

In some alternative implementations of the present embodiment, theapparatus 500 further includes a setting unit configured to set adistance value between adjacent color blocks in the two-dimensional codeto a first preset threshold.

In some alternative implementations of the present embodiment, thetwo-dimensional code picture generation unit 503 is further configuredto set a target error tolerance rate of the two-dimensional code, wherethe target error tolerance rate is greater than a second presetthreshold; convert the two-dimensional code information into thetwo-dimensional code based on the target error tolerance rate, anddisplay the generated two-dimensional code on the generated camerareal-time capturing picture.

In some alternative implementations of the present embodiment, theapparatus 500 further includes a camera turn-off unit configured to turnoff the camera in response to receiving a two-dimensional code turn-offcommand input by the user.

Referring now to FIG. 6, there is shown a schematic structural diagramof a computer system 600 adapted for implementing an electronic device(e.g., terminal devices 101, 102, 103 in FIG. 1) of an embodiment of thepresent disclosure. The electronic device shown in FIG. 6 is merely anexample and should not be construed as limiting the functionality andscope of embodiments of the present disclosure.

As shown in FIG. 6, the computer system 600 includes a centralprocessing unit (CPU) 601, which may perform various appropriate actionsand processes according to a program stored in a read-only memory (ROM)602 or a program loaded into a random access memory (RAM) 603 from astorage portion 608. The RAM 603, also stores various programs and datarequired by operations of the system 600. The CPU 601, ROM 602, and RAM603 are connected to each other via bus 604. An input/output (I/O)interface 605 is also connected to bus 604.

The following components are connected to the I/O interface 605: aninput portion 606 including a keyboard, a mouse etc.; an output portion607 including a cathode ray tube (CRT), a liquid crystal display device(LCD), a speaker etc.; a storage portion 608 including a hard disk andthe like; and a communication portion 609 including a network interfacecard, such as a LAN card and a modem. The communication portion 609performs communication processes via a network, such as the Internet. Adriver 610 is also connected to the I/O interface 605 as required. Aremovable medium 611, such as a magnetic disk, an optical disk, amagneto-optical disk, and a semiconductor memory, may be installed onthe driver 610, to facilitate the retrieval of a computer program fromthe removable medium 611, and the installation thereof on the storageportion 608 as needed.

In particular, according to embodiments of the present disclosure, theprocess described above with reference to the flow chart may beimplemented in a computer software program. For example, an embodimentof the present disclosure includes a computer program product, whichincludes a computer program that is embedded in a computer-readablemedium. The computer program includes program codes for executing themethod as illustrated in the flow chart. In such an embodiment, thecomputer program may be downloaded and installed from a network via thecommunication portion 609, and/or may be installed from the removablemedia 611. The computer program, when executed by the central processingunit (CPU) 601, implements the above mentioned functionalities asdefined by the methods of the present disclosure. It should be notedthat the computer readable medium in the present disclosure may becomputer readable signal medium or computer readable storage medium orany combination of the above two. An example of the computer readablestorage medium may include, but not limited to: electric, magnetic,optical, electromagnetic, infrared, or semiconductor systems, apparatus,elements, or a combination any of the above. A more specific example ofthe computer readable storage medium may include but is not limited to:electrical connection with one or more wire, a portable computer disk, ahard disk, a random access memory (RAM), a read only memory (ROM), anerasable programmable read only memory (EPROM or flash memory), a fibre,a portable compact disk read only memory (CD-ROM), an optical memory, amagnet memory or any suitable combination of the above. In the presentdisclosure, the computer readable storage medium may be any physicalmedium containing or storing programs which can be used by a commandexecution system, apparatus or element or incorporated thereto. In thepresent disclosure, the computer readable signal medium may include datasignal in the base band or propagating as parts of a carrier, in whichcomputer readable program codes are carried. The propagating signal maytake various forms, including but not limited to: an electromagneticsignal, an optical signal or any suitable combination of the above. Thesignal medium that can be read by computer may be any computer readablemedium except for the computer readable storage medium. The computerreadable medium is capable of transmitting, propagating or transferringprograms for use by, or used in combination with, a command executionsystem, apparatus or element. The program codes contained on thecomputer readable medium may be transmitted with any suitable mediumincluding but not limited to: wireless, wired, optical cable, RF mediumetc., or any suitable combination of the above.

A computer program code for executing operations in the disclosure maybe compiled using one or more programming languages or combinationsthereof. The programming languages include object-oriented programminglanguages, such as Java, Smalltalk or C++, and also include conventionalprocedural programming languages, such as “C” language or similarprogramming languages. The program code may be completely executed on auser's computer, partially executed on a user's computer, executed as aseparate software package, partially executed on a user's computer andpartially executed on a remote computer, or completely executed on aremote computer or server. In the circumstance involving a remotecomputer, the remote computer may be connected to a user's computerthrough any network, including local area network (LAN) or wide areanetwork (WAN), or may be connected to an external computer (for example,connected through Internet using an Internet service provider).

The flow charts and block diagrams in the accompanying drawingsillustrate architectures, functions and operations that may beimplemented according to the systems, methods and computer programproducts of the various embodiments of the present disclosure. In thisregard, each of the blocks in the flow charts or block diagrams mayrepresent a module, a program segment, or a code portion, said module,program segment, or code portion including one or more executableinstructions for implementing specified logic functions. It should alsobe noted that, in some alternative implementations, the functionsdenoted by the blocks may occur in a sequence different from thesequences shown in the figures. For example, any two blocks presented insuccession may be executed, substantially in parallel, or they maysometimes be in a reverse sequence, depending on the function involved.It should also be noted that each block in the block diagrams and/orflow charts as well as a combination of blocks may be implemented usinga dedicated hardware-based system executing specified functions oroperations, or by a combination of a dedicated hardware and computerinstructions.

The units involved in the embodiments of the present disclosure may beimplemented by means of software or hardware. The described units mayalso be provided in a processor, for example, described as: a processor,including a receiving unit, a captured picture generating unit, and atwo-dimensional code picture generating unit. Here, the names of theseunits do not in some cases constitute a limitation to such unitsthemselves. For example, the receiving unit may also be described as aunit for receiving a two-dimensional code generation instruction inputby a user.

In another aspect, the present disclosure further provides acomputer-readable medium. The computer-readable medium may be thecomputer-readable medium included in the apparatus in the abovedescribed embodiments, or a stand-alone computer-readable medium notassembled into the apparatus. The computer-readable medium stores one ormore programs. The one or more programs, when executed by a device,cause the device to: receive a two-dimensional code generationinstruction input by a user, where the two-dimensional code generationinstruction includes two-dimensional code information; start a cameraand generate a camera to capture a picture in real time; and generate areal-time picture displaying the two-dimensional code based on thetwo-dimensional code information and the generated camera real-timecapturing picture.

The above description is only a preferred embodiment of the disclosureand a description of the technical principles employed. It should beunderstood by those skilled in the art that the scope of the disclosurereferred to in this disclosure is not limited to the technical solutionsformed by specific combinations of the above-mentioned technicalfeatures, but also covers other technical solutions formed by anycombination of the above-mentioned technical features or equivalentsthereof without departing from the inventive concept. For example, theabove-mentioned features and the technical features having similarfunctions disclosed in the present disclosure are replaced with eachother.

What is claimed is:
 1. A two-dimensional code generation method appliedto a terminal device, the terminal device comprising a camera, themethod comprising: receiving a two-dimensional code generationinstruction input by a user, wherein the two-dimensional code generationinstruction comprises two-dimensional code information; starting thecamera to generate a camera real-time capturing picture; and generatinga real-time picture displaying the two-dimensional code based on thetwo-dimensional code information and the generated camera real-timecapturing picture, wherein the generating a real-time picture displayinga two-dimensional code based on the two-dimensional code information andthe generated camera real-time capturing picture comprises: setting atarget error tolerance rate of the two-dimensional code, wherein thetarget error tolerance rate is greater than a second preset threshold;and converting the two-dimensional code information into thetwo-dimensional code based on the target error tolerance rate, anddisplaying the generated two-dimensional code on the generated camerareal-time capturing picture.
 2. The method according to claim 1, whereinthe generating a real-time picture displaying a two-dimensional codebased on the two-dimensional code information and the generated camerareal-time capturing picture further comprises: performing blurringprocessing on the camera real-time capturing picture.
 3. The methodaccording to claim 1, wherein after generating a real-time picturedisplaying the two-dimensional code based on the two-dimensional codeinformation and the generated camera real-time capturing picture, themethod further comprises: setting a distance value between adjacentcolor blocks in the two-dimensional code as a first preset threshold. 4.The method according to claim 1, wherein the method further comprises:turning off the camera in response to receiving a two-dimensional codeturn-off command input by the user.
 5. A two-dimensional code generatingapparatus applied to a terminal device, the terminal device comprising acamera, the apparatus comprising: a processor and a memory storingcomputer readable instructions, wherein the instructions, when executedby the processor, cause the processor to perform operations, theoperations comprising: receiving a two-dimensional code generationinstruction input by a user, wherein the two-dimensional code generationinstruction comprises two-dimensional code information; starting thecamera to generate a camera real-time capturing picture; generating areal-time picture displaying the two-dimensional code based on thetwo-dimensional code information and the generated camera real-timecapturing picture, wherein the generating a real-time picture displayinga two-dimensional code based on the two-dimensional code information andthe generated camera real-time capturing picture comprises: setting atarget error tolerance rate of the two-dimensional code, wherein thetarget error tolerance rate is greater than a second preset threshold;and converting the two-dimensional code information into thetwo-dimensional code based on the target error tolerance rate, anddisplaying the generated two-dimensional code on the generated camerareal-time capturing picture.
 6. The apparatus according to claim 5,wherein the generating a real-time picture displaying a two-dimensionalcode based on the two-dimensional code information and the generatedcamera real-time capturing picture further comprises: performingblurring processing on the camera real-time capturing picture.
 7. Theapparatus according to claim 5, wherein after generating a real-timepicture displaying the two-dimensional code based on the two-dimensionalcode information and the generated camera real-time capturing picture,the operations further comprise: setting a distance value betweenadjacent color blocks in the two-dimensional code as a first presetthreshold.
 8. The apparatus according to claim 5, wherein the operationsfurther comprise: turning off the camera in response to receiving atwo-dimensional code turn-off command input by a user.
 9. Anon-transitory computer readable medium storing a computer program,wherein the program, when executed by a processor, causes the processorto perform operations, the operations comprising: receiving atwo-dimensional code generation instruction input by a user, wherein thetwo-dimensional code generation instruction comprises two-dimensionalcode information; starting the camera to generate a camera real-timecapturing picture; and generating a real-time picture displaying thetwo-dimensional code based on the two-dimensional code information andthe generated camera real-time capturing picture, wherein the generatinga real-time picture displaying a two-dimensional code based on thetwo-dimensional code information and the generated camera real-timecapturing picture comprises: setting a target error tolerance rate ofthe two-dimensional code, wherein the target error tolerance rate isgreater than a second preset threshold; and converting thetwo-dimensional code information into the two-dimensional code based onthe target error tolerance rate, and displaying the generatedtwo-dimensional code on the generated camera real-time capturingpicture.
 10. The computer readable medium according to claim 9, whereinthe generating a real-time picture displaying a two-dimensional codebased on the two-dimensional code information and the generated camerareal-time capturing picture further comprises: performing blurringprocessing on the camera real-time capturing picture.
 11. The computerreadable medium according to claim 9, wherein after generating areal-time picture displaying the two-dimensional code based on thetwo-dimensional code information and the generated camera real-timecapturing picture, the operations further comprise: setting a distancevalue between adjacent color blocks in the two-dimensional code as afirst preset threshold.
 12. The computer readable medium according toclaim 9, wherein the operations further comprise: turning off the camerain response to receiving a two-dimensional code turn-off command inputby a user.